package com.strutor.likou.larray;

import java.util.Set;
import java.util.TreeSet;

public class Solution {
    public static int removeDuplicates(int[] nums) {
        Set<Integer> set=new TreeSet<>();
        for (int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }
        nums = new int[set.size()];
        int i = 0;
        for (Integer j: set) {
            nums[i] = j;
            i++;
        }
        return nums.length;
    }

    public static void main(String[] args) {
        int[] nums = {1,1,2};
        removeDuplicates(nums);
        for (int i = 0; i < nums.length; i++) {
            System.out.println(nums[i]);
        }
    }
}
